﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using OneSoft.EntityCore;
using OneSoft.DataAccess;
using BySoft.Server.Common.Entity;
using BySoft.Server.Common.Schema;
using BySoft.Server.Common;

namespace BySoft.Server.DataAccess 
{
    public partial class StStockmanagedetailDA
    {
        public static DataTable SelectStockAll(string strKey)
        {
            try
            {
                string strcmd = @" SELECT ms.*,sp.ParameterName AS StockTypeName
FROM MD_Stock ms
LEFT JOIN SYS_Parameter sp ON sp.ParameterCode=ms.StockType AND sp.ParameterTypeID='StockType'
WHERE ms.[Status]<>'0'  ";

                DataAccessParameterCollection dpc = new DataAccessParameterCollection();

                strcmd += " ORDER BY ms.StockID ";

                return DataAccessCommon.Select(strcmd, dpc).Tables[0];
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public static void ListCheckCance(StStockmanagedetailEntity enStockDetail, DataAccessBroker broker)
        {
            DataAccessParameterCollection dpc = new DataAccessParameterCollection();
            string strcmd = @"";

            strcmd = @"DELETE FROM ST_StockManageDetail
WHERE FormID=@strFormID AND FormDetailID=@strFormDetailID   ";
            dpc.AddWithValue("@strFormID", enStockDetail.FormID);
            dpc.AddWithValue("@strFormDetailID", enStockDetail.FormDetailID);
            broker.ExecuteSQL(strcmd, dpc);

        }

    }
}
